import {HttpUtil} from "@/utils/modules/HttpUtil";



//获取站点配置
export const getSiteConfig = (mock:boolean) => HttpUtil.postAjax(`/wap/h5/open/getSiteConfig?mock=${mock}`)

export const getPageTicket = (data={}) => HttpUtil.postAjax(`/wap/h5/open/getPageTicket`, data)

export const checkAccessToken = () => HttpUtil.getAjax(`/wap/h5/open/checkAccessToken`)

export const getTokenByOpenId=(appId: string, code: string)=> HttpUtil.getAjax(`/wap/h5/open/loginByCode/${appId}/${code}`)

export const addAddress = (data:{}) => HttpUtil.postAjax(`/wap/h5/address/add`, data)

//获取默认收货地址
export const getAddress = (data={}) => HttpUtil.getAjax(`/wap/h5/address/pageList`, data)


export const getAllAddress = () => HttpUtil.getAjax(`/wap/h5/address/getAllAddress`)

//设置默认收货地址
export const  setDefaultAddr = (id:string | number) => HttpUtil.postAjax(`/wap/h5/address/setDefaultAddr/${id}`)

// 删除地址
export const  delAddress = (id:string | number) => HttpUtil.postAjax(`/wap/h5/address/delete/${id}`)


//获取默认收货地址
export const getEggOrderList = (data={}) => HttpUtil.getAjax(`/wap/h5/egg/getMyOrderList`, data)



//获取默认收货地址
export const updateEggOrderAddress = (data={}) => HttpUtil.postAjax(`/wap/h5/egg/updateEggOrderAddress` ,data)

//新增问卷记录
export const addQuestionnaire = (data={}) => HttpUtil.postAjax(`/wap/h5/questionnaire/add` ,data)

//获取验证码
export const getCode = (data={}) => HttpUtil.postAjax(`/wap/h5/questionnaire/getCode` ,data)

//提交问卷详情
export const addSubstance = (id:string,data={}) => HttpUtil.postAjax(`/wap/h5/questionnaire/addSubstance/${id}` ,data)




//获取猪猪分享
export const getSharePig = (code:Record<string,any>) => HttpUtil.getAjax(`/wap/im/getSharePig/${code}`)